<?php
/**
 * Created by .
 * User: akun_yu@163.com
 * Date: 2018/2/3
 * Time: 下午3:01
 */


function debug_console_log($data){
    echo '<script type="text/javascript">';
    echo 'console.log(' . json_encode($data,true) .');';
    echo '</script>';
}

/**
 * @return \Hilaoyu\LaravelExtend\ComResponse
 */
function comResponse(){
    return \Hilaoyu\Utils\UtilSupport::makeClassSingle(\Hilaoyu\LaravelExtend\ComResponse::class);
}

/**
 * @return \Hilaoyu\LaravelExtend\Services\Auth\AuthService
 */
function authService(){
    return \Hilaoyu\Utils\UtilSupport::makeClassSingle(\Hilaoyu\LaravelExtend\Services\Auth\AuthService::class);
}

function comDebug($message){
    if(app()->runningInConsole()){
        (new Symfony\Component\Console\Output\ConsoleOutput())->writeln($message);
    }else{
        comResponse()->withDebug($message);
    }
}
